<?php

namespace Home\Model;
use Think\Model;
class ReturnMoneyModel extends BaseModel{
    
    //省市信息表
    protected $tableName = 'tp_return_money';

    /**
     * @Desc  : 添加返现记录
     * @Author：quyang
     * @Param ：
     * @Time  ：2017/4/8 14:41
     * @Update：2017/4/8
     **/
    public function addRechargeLog( $stationId , $proxyId , $num , $money , $orderId )
    {

        $where = [
            'f_station_id'      => $stationId,
            'f_proxy_id'        => $proxyId,
            'f_recharge_num'    => $num,
            'f_return_money'    => $money,
            'f_order_id'        =>$orderId,
            'f_create_time'     => time()
        ];

        return $this->add( $where );

    }

    /**
     * @Desc  : 查询是否存在同样的订单
     * @Author：quyang
     * @Param ：
     * @Time  ：2017/4/11 11:35
     * @Update：2017/4/11
     **/
    public function queryOrder( $stationId , $orderId )
    {

        $where = "`f_station_id` = {$stationId} AND `f_order_id` = '".$orderId."'";

        return $this->where( $where )->find();

    }
    
    

}